<!--已审核成绩修改-->
<template>
  <div class="assessment-container" style="width:100%">
    <div class="search-container" style="margin:0;padding:0">
      <div class="search-container-left">
        <div class="search-container-item">
          <span>学号:</span>
          <el-input
            style="width: 152px"
            size="mini"
            placeholder="请输入内容"
            v-model="studentid"
            clearable
          ></el-input>
        </div>
        <div class="search-container-item">
          <span>学期:</span>
          <el-select
            v-model="xueqi"
            style="width: 100px"
            size="mini"
            placeholder="请选择"
            clearable
          >
            <el-option
              v-for="(item,index) in xqList"
              :key="index"
              :label="item.xqmc"
              :value="item.xqmc"
            >
            </el-option>
          </el-select>
        </div>
        <!-- <el-button type="primary" @click="queryallscore" icon="el-icon-search" size="mini">查 询</el-button> -->
        <div class="search-button" @click="searchClick">
          <img src="../../../assets/assessment/icon-search.png" alt=""/>
          <span>查询</span>
        </div>
      </div>
    </div>
    <div class="plan-entry-table-container">
      <el-table
        :data="tableData"
        border
        style="width: 100%;border: 1px solid #004ca7;"
        class="xpaas-table-class"
        row-class-name="xpaas-row-class"
        cell-class-name="xpaas-cell-class"
        header-row-class-name="xpaas-header-row-class"
        header-cell-class-name="xpaas-header-cell-class"
      >

        <el-table-column prop="xueqi" label="学期" width="80" align="center">
        </el-table-column>
        <el-table-column
          prop="courseno"
          label="课程编号"
          width="146"
          align="center"
        >
        </el-table-column>

        <el-table-column
          prop="prelectcourse"
          label="课程名称"
          width="140"
          align="center"
        >
        </el-table-column>
        <el-table-column prop="xf" label="学分" width="86" align="center">
        </el-table-column>
        <el-table-column
          prop="rkjy"
          label="任课教员"
          width="106"
          align="center"
        >
        </el-table-column>
        <el-table-column prop="scorenumber" label="总评成绩" width="90" align="center">
        </el-table-column>
        <el-table-column prop="cjfz" label="录入成绩分制" width="120" align="center">
        </el-table-column>
        <el-table-column prop="checkusualscore" label="课下作业成绩" width="126" align="center">
        </el-table-column>
        <el-table-column prop="checkexperimentscore" label="课堂成绩测评" width="130" align="center">
        </el-table-column>
        <el-table-column prop="checkmidtermscore" label="期中考试成绩" width="126" align="center">
        </el-table-column>

        <el-table-column prop="issue" label="课终考核成绩" width="126" align="center">
        </el-table-column>
        <el-table-column prop="bkscore" label="补考成绩" width="90" align="center">
        </el-table-column>
        <el-table-column prop="onemorescore" label="第二次补考成绩" width="136" align="center">
        </el-table-column>
        <el-table-column prop="cjxz" label="成绩性质" width="90" align="center">
        </el-table-column>
        <el-table-column
          prop="lrcj"
          label="操作"
          width="141"
          align="center"
          class-name=""
          label-class-name=""
        >
          <template slot-scope="scope">
            <div class="bk-lucj-import-button" @click="toMakeupScoreEntry(scope.$index)">
              <img
                src="../../../assets/assessment/icon-plan-record-detail.png"
                alt=""
              />
              <span>修改</span>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <div class="block" style="margin-bottom: 50px;">
        <el-pagination
          style="width:auto;margin-top: 15px;float:right;margin-bottom:50px;padding:0"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="pageNo"
          :page-sizes="[5, 10, 20, 30,50,100,200]"
          :page-size="5"
          layout="total, sizes, prev, pager, next, jumper"
          :total="tableData.length > 0 ? tableData[0].tol : ''"
        >
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
import {conditionPostList} from "../../../api/courseAchievement/entryResults";
import {queryallscore,reqGetXqList } from "@/api/admin1/check";

export default {

  data() {
    return {
      pageNo:1,
      pageSize:5,
      studentid:'',
      planid:'',
      xueqi: "",
      xqList: [],
      tableData: [],
      coursename: ''
    };
  },
  mounted() {
    this.termAll();
  },
  methods: {
    handleCurrentChange(val) {
      this.pageNo = val;
      this.queryallscore();
    },
    handleSizeChange(val) {
      this.pageSize = val;
      this.queryallscore();
    },
    // 获取学期
    async termAll() {
      const result = await reqGetXqList();
      if (result.data.code == 200) {
        this.xueqi = result.data.data[0].xqmc;
        this.xqList = result.data.data;
        this.queryallscore()
      }
    },
    //查询全部
    queryallscore(){
      let obj={
        studentid:this.studentid,
        xueqi:this.xueqi,
        pageNo:this.pageNo,
        pageSize:this.pageSize
      }
      return new Promise(() => {
        queryallscore(obj).then(res => {
          if (res.data.code == 200){
            this.tableData = res.data.data;
            this.pageNo = 1;
          }
        })
      })
    },
    //点击查询按钮
    searchClick(){
      this.pageNo = 1;
      this.queryallscore();
    },
    //修改跳转
    toMakeupScoreEntry(index){
      let id= this.tableData[index].id;
      let planid = this.tableData[index].planid
      this.$router.push({path: '/admin/scoreManagement/ruditedResults',query: { id: id,planid:planid},
      })
    },

    /* queryPostList: function () {
      let obj = {
        oldxueqi: this.oldxueqi,
        coursename: this.coursename,
      }
      return new Promise(() => {
        conditionPostList(obj).then(res => {
          this.tableData = res.data.data
          let arr = [];
          let b;
          for (let a = 0; a < this.tableData.length; a++) {
            arr = this.tableData[a].oldview.split("/")
            for (let i = 0; i < arr.length; i++) {
              for (let t = i + 1; t < arr.length; t++) {
                this.tableData[a].wl = arr[i];
                this.tableData[a].yl = arr[t];
              }
            }
          }
        })
      })
    } */
  },

};
</script>
<style lang="less" scoped>
.plan-entry-table-container {
  margin-top: 15px;

  .el-table td,
  .el-table th.is-leaf,
  .el-table--border,
  .el-table--group {
    border-color: #c7d7eb;
  }

  .el-table__header tr,
  .el-table__header th {
    padding: 0;
    height: 76px;
    background-color: #edf2f9;
    font-size: 16px;
    font-family: Microsoft YaHei;
    font-weight: bold;
    line-height: 20px;
    color: #004ca7;
  }

  .el-table__body tr,
  .el-table__body td {
    padding: 0;
    height: 86px;
  }

  .export-button {
    background: #fff6ef;
    border: 1px solid #f3b815;
    width: auto;
    height: 28px;
    line-height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;

    > span {
      font-size: 14px;
      font-family: Microsoft YaHei;
      font-weight: 400;
      color: #f3b815;
    }

    > img {
      width: 16px;
      height: 16px;
      margin-right: 5px;
    }
  }

  .bk-lucj-import-button {
    .export-button;
    width: 70px;
    background: #f1fff8;
    border: 1px solid #02c86c;
    box-sizing: border-box;
    margin: 0 auto 12px;

    &:last-child {
      margin-bottom: 0px;
    }

    > span {
      color: #02c86c;
    }
  }

  .bk-lucj-expot-button {
    .export-button;
    width: 156px;
    background: #fef1e8;
    border: 1px solid #f86900;
    box-sizing: border-box;
    margin: 0 auto 12px;

    &:last-child {
      margin-bottom: 0px;
    }

    > span {
      color: #f86900;
    }
  }
}
</style>

<style lang="less" scoped>
@import "../../../styles/entry-results.less";

.plan-entry-table-container {
  margin-top: 15px;

  .table-data {
    width: 100%;
    border: 0.8px solid #004ca7;
    border-radius: 9px;
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #004ca7;
  }
}
@fontFamily:"Microsoft YaHei";
.xpaas-table-class {
  border: 1px solid #004ca7;
  border-radius: 9px;
  > ::v-deep div.el-table__header-wrapper {
    > table.el-table__header {
      > thead {
        > tr.xpaas-header-row-class {
          padding: 0;
          height: 76px;
          background-color: #edf2f9;
          font-size: 16px;
          font-family: Microsoft YaHei;
          font-weight: bold;
          line-height: 20px;
          color: #004ca7;
          > th.xpaas-header-cell-class {
            font-weight: bold;
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
  > ::v-deep div.el-table__body-wrapper {
    > table.el-table__body {
      > tbody {
        > tr.xpaas-row-class {
          > td.xpaas-header-cell-class {
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            background-color: #edf2f9;
            > div.cell {
              font-size: 16px;
              font-weight: bold;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
          > td.xpaas-cell-class {
            height: 76px;
            
            border-right: 1px solid #c7d7eb;
            border-left: 0;
            border-bottom: 1px solid #c7d7eb;
            > div.cell {
              font-weight: normal;
              font-family: @fontFamily;
              color: #004ca7;
            }
          }
        }
      }
    }
  }
}
</style>
